package com.example.mybase;


import com.example.mybase.commom.config.data.DataSourceNames;
import com.example.mybase.commom.config.data.annotation.DataSource;
import com.example.mybase.entity.User;
import com.example.mybase.mapper.UserMapper;
import com.example.mybase.service.IUserService;
import com.example.mybase.service.impl.UserServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 测试多数据源
 */
@Service
public class DataSourceTestService implements IDataSourceTestService {
    @Autowired
    private UserMapper userMapper;


    @Override
    public User test1(int id) {
        return userMapper.Sel(id);
    }

    @Override
    @DataSource(name = DataSourceNames.SECOND)
    public User test2(int id) {
        return userMapper.Sel(id);
    }
}